import 'package:environmental_les_app/common/style/colours.dart';
import 'package:environmental_les_app/common/widgets/rich_text.dart';
import 'package:flutter/material.dart';

class RequiredFieldText extends StatelessWidget {
  final String text;
  final double? titleFontSize;
  final Color? titleColor;
  final bool isRequired;
  final FontWeight? titleFontWeight;
  const RequiredFieldText(
      {super.key,
      required this.text,
      this.titleFontSize = 16,
      this.isRequired = true,
      this.titleColor = Colours.text254,
      this.titleFontWeight = FontWeight.w500});

  @override
  Widget build(BuildContext context) {
    return RichTextWidget(children: [
      if (isRequired)
        const TextSpan(
          text: "*",
          style: TextStyle(color: Colors.red, fontSize: 15),
        ),
      TextSpan(
        text: text,
        style: TextStyle(
            color: titleColor,
            fontWeight: titleFontWeight,
            fontSize: titleFontSize),
      ),
    ]);
  }
}
